<extend name="./public/frame.html"/>
<block name="content">

    <form class="layui-form" action="" method="post">
        <div class="layui-form-item">
            <table class="layui-table" lay-size="sm" style="margin-bottom: 15px">
                <tr>
                    <td colspan="2" class="startInfo" style="text-align: center;font-size: 30px;height: 50px;color: green">开始更新数据</td>
                </tr>
                <tr>
                    <td style="width: 50%;text-align: center;font-size: 30px;height: 50px;">总共有：<?php echo $count;?> 条数据</td>
                    <td style="width: 50%;text-align: center;font-size: 30px;height: 50px;">已更新：<span class="aa">0</span> 条数据</td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center;height: 300px;padding-left: 430px;">
                        <span style="font-size: 50px;display: block;width: 300px;height:300px;float: left;line-height: 300px;" class="pageNum">0</span>
                        <span style="display: block;width: 200px;height:300px;float: left;line-height: 300px;">~</span>
                        <span style="font-size: 50px;display: block;width: 300px;height:300px;float: left;line-height: 300px;" class="numll">10</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="startInfo" style="text-align: center;height: 50px;">
                        <span class="layui-btn startGengxing" onclick="gengxing(0,'<?php echo $page;?>')">开始更新</span>
                        <span class="layui-btn layui-btn-warm update" style="display: none;">正在处理...</span>
                    </td>
                </tr>
            </table>
        </div>
    </form>

    <script>
       function gengxing(start,end) {
           $('.startGengxing').css('display','none');
           $('.update').css('display','');
           $.ajax({
               url:'{:url("/admin/Member/gengxing")}',
               async:true,
               dataType:'json',
               type:'POST',
               data: {'start':start,'end':end},
               success:function(res){
                   var dataobj = $.parseJSON(res);
                   if(dataobj.code==1){
                       $('.pageNum').html(dataobj.starty);
                       $('.aa').html(dataobj.sumNum);
                       $('.numll').html(dataobj.numll);
                       gengxing(dataobj.starty,end);
                   }else{
                       $('.update').html('更新完成');
                       layer.msg(dataobj.msg,{icon: 5});
                   }
               }
           });
           return false;
       }
    </script>
</block>
